import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LangVO, LangForm, LangQuery } from '@/api/llm/lang/types';

/**
 * 查询语言文件列表
 * @param query
 * @returns {*}
 */

export const listLang = (query?: LangQuery): AxiosPromise<LangVO[]> => {
  return request({
    url: '/llm/lang/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询语言文件详细
 * @param id
 */
export const getLang = (id: string | number): AxiosPromise<LangVO> => {
  return request({
    url: '/llm/lang/' + id,
    method: 'get'
  });
};

/**
 * 新增语言文件
 * @param data
 */
export const addLang = (data: LangForm) => {
  return request({
    url: '/llm/lang',
    method: 'post',
    data: data
  });
};

/**
 * 修改语言文件
 * @param data
 */
export const updateLang = (data: LangForm) => {
  return request({
    url: '/llm/lang',
    method: 'put',
    data: data
  });
};

/**
 * 删除语言文件
 * @param id
 */
export const delLang = (id: string | number | Array<string | number>) => {
  return request({
    url: '/llm/lang/' + id,
    method: 'delete'
  });
};
